<template>
  <view>
    <view style="background-color: #f4f5f7">
      <view style="padding: 0.3rem; text-align: center">-商品网点-</view>
    </view>

    <view class="inputS">
      <u-form :model="form" ref="uForm">
        <u-form-item
          style="padding: 0.7rem 1rem"
          prop="name"
          label-width="auto"
          label="网点名称"
          ><u-input v-model="form.name"
          placeholder="请填写铺货网点名称"
        /></u-form-item>

        <u-form-item
          style="padding: 0.7rem 1rem"
          prop="intro"
          label-width="auto"
          label="网点电话"
          ><u-input v-model="form.phone"
           placeholder="请填写铺货网点电话"
        /></u-form-item>

        <u-form-item
          style="padding: 0.7rem 1rem"
          prop="sex"
          label-width="auto"
          label="网点位置"
          right-icon='map'
          ><u-input v-model="form.sex"
          aplaceholder="请填写铺货网点地址"
        /></u-form-item>

        <u-form-item
          style="padding: 0.7rem 1rem"
          prop="sex"
          label-width="auto"
          label="网点经纬度"
          ><u-input v-model="form.sex"
          aplaceholder="请填写经纬度"
        /></u-form-item>
        <u-form-item
          style="padding: 0.7rem 1rem"
          prop="sex"
          label-width="auto"
          label="网点行业"
          ><u-input v-model="form.sex"
          aplaceholder="请填写铺货网点行业"
        /></u-form-item>
           <u-form-item
          style="padding: 0.7rem 1rem"
          prop="sex"
          label-width="auto"
          label="营业时间"
          >
          <u-input v-model="form.data"
        />
          </u-form-item> 
      </u-form>
    </view>
    <u-calendar v-model="show" :mode="mode"  @change="change"></u-calendar>

    <view class="footP">
      <view
        @click="nextM"
        style="padding: 0.7rem; display: flex; align-items: center"
      >
        <!-- <img style="width: 1rem;" src="../../style/image/cargo/add.jpg" alt=""> -->
        <view style="color: white; margin-left: 0.2rem">下一步</view>
      </view>
    </view>

    
  </view>
</template>

<script lang='ts' >
import { Component, Prop, Vue, Watch, Emit } from "vue-property-decorator";

@Component({
  //   @Component  是一个装修器   不可以在下面写语句
  name: "test",
})
export default class extends Vue {
  @Prop({
    type: String, // 父组件传递给子组件的数据类型
    required: false, // 是否必填
    default: " ", // 默认值， 如果传入的是 Object，则要 default: ()=>({}) 参数为函数
  })
  msg!: string;

  public show=true
  public mode='range'

  public form = {
    name: "",
    phone: "",
    sex: "",
  };
  public rules = {
    name: [
      {
        required: true,
        message: "请输入姓名",
        // 可以单个或者同时写两个触发验证方式
        trigger: ["change", "blur"],
      },
    ],
    intro: [
      {
        // min: 5,
        message: "简介不能少于5个字",
        // trigger: 'change'
      },
    ],
  };

  onReady() {
    // this.$refs.uForm.setRules(this.rules);

  (this.$refs['uForm'] as any).setRules(this.rules)
      console.log(123);
  }
  created() {
    // this.$refs.uForm.setRules(this.rules);
  }

  mounted() {
    //  console.log('父组件传递的参数:',this.$parent)   //暂时不考虑
    //this.$refs.uForm.setRules(this.rules);
  }

  nextM(){
  
   uni.navigateTo({
      url: '../../pages/item/modify/index',
    });
  
  }
  change(e:any) {
				console.log(e);
			}
}
</script>

<style  scoped>
.footP {
  position: absolute;
  bottom: 0;
  background-color: #02af74;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
</style>